package com.bangyu.monitor.modular.system.warpper;

import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import com.bangyu.monitor.core.util.Beans;
import com.bangyu.monitor.modular.system.entity.Bridge;
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;

import java.util.List;
import java.util.Map;

/**
 * @Auther: zhangxue
 * @Date: 19/4/1 14:06
 * @Description:
 */
public class BridgeWrapper extends BaseControllerWrapper {

    public BridgeWrapper(Page page) {
        super(page.setRecords(Beans.beansToMaps(page.getRecords())));
    }

    public BridgeWrapper(List<Bridge> list) {
        super(Beans.beansToMaps(list));
    }

    @Override protected void wrapTheMap(Map<String, Object> map) {
        Object lngObj = map.get("lng");
        Object latObj = map.get("lat");
        if (lngObj != null && latObj != null) {
            //            Double lng = Double.parseDouble(lngObj.toString());
            //            Double lat = Double.parseDouble(latObj.toString());
            map.put("coordinate", String.format("%s,%s", lngObj.toString(),
                    latObj.toString()));
        }

    }

}
